﻿namespace design
{
	public partial class _Default : PageTemplate
	{
// как сделать подзапрос книги и статьи
// и что вообще должно быть на главной странице
		protected override string GetSQLStr(int lowerBorder, int upperBorder)
		{
			string cmdText = "select * ";
			cmdText += "from ( ";
			cmdText += "select row_number() over( ";
			cmdText += "order by date desc) as rownum, ";
			cmdText += "books.id, books.id_author, books.id_media, books.description, ";
			cmdText += "books.path, books.date, books.title, ";
			cmdText += "medias.path as mpath, ";
			cmdText += "authors.lastname as alast ";
			cmdText += "from books, medias, authors ";
			cmdText += "where books.id_media = medias.id and books.id_author = authors.id ) ";
			cmdText += "as b ";
			cmdText += "where rownum between " + lowerBorder + " and " + upperBorder;

			return cmdText;
		}
	}
}
